package com.itheima.dao;

import com.itheima.pojo.Book;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface BookDao {
    @Select("select * from book where id = #{id}")
    Book getById(Integer id);

    @Select("SELECT * FROM book ORDER BY id DESC ")
    List<Book> getAll();
    @Insert("insert into book values(null,#{name},#{ip})")
    int addtime(@Param("name") String name, @Param("ip") String ip);
}
